#ifndef _ML_INTERSTREAM_COMMANDER_H_
#define _ML_INTERSTREAM_COMMANDER_H_
#include "MLConsoleCommander.h"
#include "MLTools_TxtFileLoader.h"
#include "MLTools_TxtFileSaver.h"

#include "MLDataSet.h"
#include "MLTools.h"
#include "MLTools_Stat.h"

#include "MLInterStreamAnalysis.h"
#include "MLInterStream.h"
#include "MLNBAStatDataLoader.h"

using namespace mylablib;

class CMLInterStreamCommander : public CMLConsoleCommander
{
public:
	// Constructor and Destructor
	CMLInterStreamCommander(void);
	~CMLInterStreamCommander(void);

public:
	// virtual method
	virtual int Run(const std::vector<std::wstring>& vCommands);

private:
	// Implementations
	int RunInterStreamAnalysis(const std::vector<std::wstring>& vCommand);
	int InitInterStream(void);
	int InitInterStreamAnalysis(void);
	int InitStreamLoader(void);
	int InitOutputFile(void);
	int CloseAll(void);
	int OutputClusters(void);
	int RunInterStreamAnalysis(void);

private:
	// NBA Stats Data Converter
	int RunNBAStatsDataConvert(const std::vector<std::wstring>& vCommand);


private:
	// Fields
	std::wstring m_wstrInputFileName;
	std::wstring m_wstrOutputFileName;
	std::wstring m_wstrSnapshotsFilename;

	// Parameters for InterStream
	CMLDataPoint m_DistWeights;
	int m_nInitNumber;
	int m_nStreamBufferSize;
	int m_nStreamStartPos;
	int m_nStreamMaxLength;
	int m_nInitNumClusters;
	int m_nMinNumClusters;
	int m_nMaxNumClusters;
	int m_nTimeHorizon;
	int m_nTimeUnit;
	int m_nSizePerTime;
	double m_dMaxRadius;
	bool m_bDataContainTimeStamp;
	bool m_bInterAnalysis;

	// Parameters for InterStreamAnalysis
	int m_nDimension;
	int m_nRegressP1;
	int m_nRegressP2;
	int m_nInterventionPosition;
	int m_nPeriodStart;
	int m_nPeriodEnd;

	CMLInterStream* m_pInterStream;
	CMLInterStreamAnalysis* m_pInterStreamAnalysis;

	CMLTools_TxtFileLoader m_StreamLoader;

	std::wofstream m_OutputFile;

};


#endif
